﻿#include "forward_config.h"

Forward_Config* Forward_Config::instance = nullptr;

Forward_Config::Forward_Config()
{
    g_ServerHost = "192.168.0.150";    
    g_ServerPort = 1116;  
    g_TimeoutSecond = 30000;
}

QString Forward_Config::GetServerHost()
{
    init();
    return instance->g_ServerHost;
}

int Forward_Config::GetServerPort()
{
    init();
    return instance->g_ServerPort;
}

int Forward_Config::GetTimeoutSecond()
{
    init();
    return instance->g_TimeoutSecond;
}

void Forward_Config::SetServerHost(QString host)
{
    init();
    instance->g_ServerHost = host;
}

void Forward_Config::SetServerPort(int port)
{
    init();
    instance->g_ServerPort = port;
}

void Forward_Config::SetTimeoutSecond(int second)
{
    init();
    instance->g_TimeoutSecond = second;
}

void Forward_Config::Release()
{
    delete instance;
    instance = nullptr;
}

void Forward_Config::init()
{
    if(instance == nullptr)
    {
        instance = new Forward_Config();
    }
}
